Left Termination of the query pattern ackerman_in_3(g, g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

ackerman(0, N, s(N)).
ackerman(s(M), 0, Res) :- ackerman(M, s(0), Res).
ackerman(s(M), s(N), Res) :- ','(ackerman(s(M), N, Res1), ackerman(M, Res1, Res)).

Queries:

ackerman(g,g,a).

We use the technique of [30].Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

ackerman_in(s(M), s(N), Res) → U2(M, N, Res, ackerman_in(s(M), N, Res1))
ackerman_in(s(M), 0, Res) → U1(M, Res, ackerman_in(M, s(0), Res))
ackerman_in(0, N, s(N)) → ackerman_out(0, N, s(N))
U1(M, Res, ackerman_out(M, s(0), Res)) → ackerman_out(s(M), 0, Res)
U2(M, N, Res, ackerman_out(s(M), N, Res1)) → U3(M, N, Res, ackerman_in(M, Res1, Res))
U3(M, N, Res, ackerman_out(M, Res1, Res)) → ackerman_out(s(M), s(N), Res)

The argument filtering Pi contains the following mapping:
ackerman_in(x1, x2, x3)  =  ackerman_in(x1, x2)
s(x1)  =  s(x1)
U2(x1, x2, x3, x4)  =  U2(x1, x4)
0  =  0
U1(x1, x2, x3)  =  U1(x3)
ackerman_out(x1, x2, x3)  =  ackerman_out(x3)
U3(x1, x2, x3, x4)  =  U3(x4)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

ackerman_in(s(M), s(N), Res) → U2(M, N, Res, ackerman_in(s(M), N, Res1))
ackerman_in(s(M), 0, Res) → U1(M, Res, ackerman_in(M, s(0), Res))
ackerman_in(0, N, s(N)) → ackerman_out(0, N, s(N))
U1(M, Res, ackerman_out(M, s(0), Res)) → ackerman_out(s(M), 0, Res)
U2(M, N, Res, ackerman_out(s(M), N, Res1)) → U3(M, N, Res, ackerman_in(M, Res1, Res))
U3(M, N, Res, ackerman_out(M, Res1, Res)) → ackerman_out(s(M), s(N), Res)

The argument filtering Pi contains the following mapping:
ackerman_in(x1, x2, x3)  =  ackerman_in(x1, x2)
s(x1)  =  s(x1)
U2(x1, x2, x3, x4)  =  U2(x1, x4)
0  =  0
U1(x1, x2, x3)  =  U1(x3)
ackerman_out(x1, x2, x3)  =  ackerman_out(x3)
U3(x1, x2, x3, x4)  =  U3(x4)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

ACKERMAN_IN(s(M), s(N), Res) → U21(M, N, Res, ackerman_in(s(M), N, Res1))
ACKERMAN_IN(s(M), s(N), Res) → ACKERMAN_IN(s(M), N, Res1)
ACKERMAN_IN(s(M), 0, Res) → U11(M, Res, ackerman_in(M, s(0), Res))
ACKERMAN_IN(s(M), 0, Res) → ACKERMAN_IN(M, s(0), Res)
U21(M, N, Res, ackerman_out(s(M), N, Res1)) → U31(M, N, Res, ackerman_in(M, Res1, Res))
U21(M, N, Res, ackerman_out(s(M), N, Res1)) → ACKERMAN_IN(M, Res1, Res)

The TRS R consists of the following rules:

ackerman_in(s(M), s(N), Res) → U2(M, N, Res, ackerman_in(s(M), N, Res1))
ackerman_in(s(M), 0, Res) → U1(M, Res, ackerman_in(M, s(0), Res))
ackerman_in(0, N, s(N)) → ackerman_out(0, N, s(N))
U1(M, Res, ackerman_out(M, s(0), Res)) → ackerman_out(s(M), 0, Res)
U2(M, N, Res, ackerman_out(s(M), N, Res1)) → U3(M, N, Res, ackerman_in(M, Res1, Res))
U3(M, N, Res, ackerman_out(M, Res1, Res)) → ackerman_out(s(M), s(N), Res)

The argument filtering Pi contains the following mapping:
ackerman_in(x1, x2, x3)  =  ackerman_in(x1, x2)
s(x1)  =  s(x1)
U2(x1, x2, x3, x4)  =  U2(x1, x4)
0  =  0
U1(x1, x2, x3)  =  U1(x3)
ackerman_out(x1, x2, x3)  =  ackerman_out(x3)
U3(x1, x2, x3, x4)  =  U3(x4)
U31(x1, x2, x3, x4)  =  U31(x4)
U21(x1, x2, x3, x4)  =  U21(x1, x4)
ACKERMAN_IN(x1, x2, x3)  =  ACKERMAN_IN(x1, x2)
U11(x1, x2, x3)  =  U11(x3)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

ACKERMAN_IN(s(M), s(N), Res) → U21(M, N, Res, ackerman_in(s(M), N, Res1))
ACKERMAN_IN(s(M), s(N), Res) → ACKERMAN_IN(s(M), N, Res1)
ACKERMAN_IN(s(M), 0, Res) → U11(M, Res, ackerman_in(M, s(0), Res))
ACKERMAN_IN(s(M), 0, Res) → ACKERMAN_IN(M, s(0), Res)
U21(M, N, Res, ackerman_out(s(M), N, Res1)) → U31(M, N, Res, ackerman_in(M, Res1, Res))
U21(M, N, Res, ackerman_out(s(M), N, Res1)) → ACKERMAN_IN(M, Res1, Res)

The TRS R consists of the following rules:

ackerman_in(s(M), s(N), Res) → U2(M, N, Res, ackerman_in(s(M), N, Res1))
ackerman_in(s(M), 0, Res) → U1(M, Res, ackerman_in(M, s(0), Res))
ackerman_in(0, N, s(N)) → ackerman_out(0, N, s(N))
U1(M, Res, ackerman_out(M, s(0), Res)) → ackerman_out(s(M), 0, Res)
U2(M, N, Res, ackerman_out(s(M), N, Res1)) → U3(M, N, Res, ackerman_in(M, Res1, Res))
U3(M, N, Res, ackerman_out(M, Res1, Res)) → ackerman_out(s(M), s(N), Res)

The argument filtering Pi contains the following mapping:
ackerman_in(x1, x2, x3)  =  ackerman_in(x1, x2)
s(x1)  =  s(x1)
U2(x1, x2, x3, x4)  =  U2(x1, x4)
0  =  0
U1(x1, x2, x3)  =  U1(x3)
ackerman_out(x1, x2, x3)  =  ackerman_out(x3)
U3(x1, x2, x3, x4)  =  U3(x4)
U31(x1, x2, x3, x4)  =  U31(x4)
U21(x1, x2, x3, x4)  =  U21(x1, x4)
ACKERMAN_IN(x1, x2, x3)  =  ACKERMAN_IN(x1, x2)
U11(x1, x2, x3)  =  U11(x3)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 1 SCC with 2 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
PiDP
              ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

U21(M, N, Res, ackerman_out(s(M), N, Res1)) → ACKERMAN_IN(M, Res1, Res)
ACKERMAN_IN(s(M), s(N), Res) → ACKERMAN_IN(s(M), N, Res1)
ACKERMAN_IN(s(M), s(N), Res) → U21(M, N, Res, ackerman_in(s(M), N, Res1))
ACKERMAN_IN(s(M), 0, Res) → ACKERMAN_IN(M, s(0), Res)

The TRS R consists of the following rules:

ackerman_in(s(M), s(N), Res) → U2(M, N, Res, ackerman_in(s(M), N, Res1))
ackerman_in(s(M), 0, Res) → U1(M, Res, ackerman_in(M, s(0), Res))
ackerman_in(0, N, s(N)) → ackerman_out(0, N, s(N))
U1(M, Res, ackerman_out(M, s(0), Res)) → ackerman_out(s(M), 0, Res)
U2(M, N, Res, ackerman_out(s(M), N, Res1)) → U3(M, N, Res, ackerman_in(M, Res1, Res))
U3(M, N, Res, ackerman_out(M, Res1, Res)) → ackerman_out(s(M), s(N), Res)

The argument filtering Pi contains the following mapping:
ackerman_in(x1, x2, x3)  =  ackerman_in(x1, x2)
s(x1)  =  s(x1)
U2(x1, x2, x3, x4)  =  U2(x1, x4)
0  =  0
U1(x1, x2, x3)  =  U1(x3)
ackerman_out(x1, x2, x3)  =  ackerman_out(x3)
U3(x1, x2, x3, x4)  =  U3(x4)
U21(x1, x2, x3, x4)  =  U21(x1, x4)
ACKERMAN_IN(x1, x2, x3)  =  ACKERMAN_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ PiDP
              ↳ PiDPToQDPProof
QDP
                  ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

ACKERMAN_IN(s(M), s(N)) → ACKERMAN_IN(s(M), N)
U21(M, ackerman_out(Res1)) → ACKERMAN_IN(M, Res1)
ACKERMAN_IN(s(M), 0) → ACKERMAN_IN(M, s(0))
ACKERMAN_IN(s(M), s(N)) → U21(M, ackerman_in(s(M), N))

The TRS R consists of the following rules:

ackerman_in(s(M), s(N)) → U2(M, ackerman_in(s(M), N))
ackerman_in(s(M), 0) → U1(ackerman_in(M, s(0)))
ackerman_in(0, N) → ackerman_out(s(N))
U1(ackerman_out(Res)) → ackerman_out(Res)
U2(M, ackerman_out(Res1)) → U3(ackerman_in(M, Res1))
U3(ackerman_out(Res)) → ackerman_out(Res)

The set Q consists of the following terms:

ackerman_in(x0, x1)
U1(x0)
U2(x0, x1)
U3(x0)

We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: